<!DOCTYPE html>
<html lang="zh-cn">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
	<meta http-equiv="X-UA-Compatable" content="IE=edge,Chrome=1.0">
	<meta name="format-detection" content="telephone=no">
	<meta name="format-detection" content="email=no">   
	<title>小王子体验馆门票</title>
	<link rel="stylesheet" href="{$_C.hy_path}css/normalize.css">
	<link rel="stylesheet" href="{$_C.hy_path}css/main6.css">
	 <link rel="stylesheet" href="{$_C.hy_path}css/swiper.min.css">
	 
	 
</head>
<body>
	<!-- <div class="banner">
		<img src="{$_C.hy_path}images/prince/banner3.png" alt="">
		
	</div> -->
	
	 <div class="swiper-container">
        <div class="swiper-wrapper">
            <div  class="swiper-slide"   >
            	<a href="http://g4.shfyuan.com/xy/html/xiaowangzi-code4">
            	<img src="/xy/Uploads/banner/banner1.png" style="width:100%;height:100%" >
				</a>
            </div>
            
            <div  class="swiper-slide"   >
            	<a href="http://g4.shfyuan.com/xy/html/xiaowangzi-code4">
            	<img src="/xy/Uploads/banner/banner2.png" style="width:100%;height:100%" >
				</a>
            </div>
            
            <div  class="swiper-slide"   >
            	<a href="http://g4.shfyuan.com/xy/html/xiaowangzi-code4">
            	<img src="/xy/Uploads/banner/banner3.png" style="width:100%;height:100%" >
				</a>
            </div>
            
        </div>
        <!-- Add Pagination -->
        <div class="swiper-pagination"></div>
        <!-- Add Arrows -->
        
    </div>
	
	
	<form class="stuff_list">
		
		<div class="submit" style="width:90%;padding:5%;padding-top:15px;">
			<h4 style="float:left">合计：￥<span id="sumPay" >0</span></h4>
			
			<!-- <a style="float:left;margin-right:0px;width:40%"  onClick="openCode()" id="btnYaoqingma"  class="btn ">邀请码</a> -->
			<a style="float:right;margin-right:0px;width:40%" onClick="flgSubmitInfo()" id="btnXiadan"  class="btn xiadan">立即下单</a>
			
		</div>
	
		 <div class="stuff row stuff_click">
			<div class="col radio">
				<p><span></span></p>
			</div>
			<div class="col">
				<img src="{$_C.hy_path}images/prince/little_king.png" alt="">
			</div>
			<div class="col">
				<h4>体验馆慈善专场门票</h4>
				<div class="row">
					<div class="col">
						<p></p>
						<p>限11.28</p>
						<p>G4慈善专场使用 </p>
					</div>
					<div class="col">
						<h3>￥68</h3>
						<span class="cut">-</span>
						<input type="text" name="card2_total" id="card2_total" value="0"  readonly="readonly"  >
						<span class="add">+</span>
					</div>
				</div>
			</div>
		</div> 
		<div class="stuff row stuff_click" >
			<div class="col radio">
				<p><span></span></p>
			</div>
			<div class="col">
				<img src="{$_C.hy_path}images/prince/little_king.png" alt="">
			</div>
			<div class="col">
				<h4>成人门票一张套餐</h4>
				<div class="row">
					<div class="col">
						
						<p>10月30日到11月30日</p>
						<p>任意时间使用 </p>
					</div>
					<div class="col">
						<h3>￥88</h3>
						
							<span class="cut">-</span>
							<input type="text" name="card1_total" id="card1_total" value="0" readonly="readonly"  >
							<span class="add">+</span>
						
					</div>
				</div>
			</div>
		</div>
		
		<div class="stuff row stuff_click" >
			<div class="col radio">
				<p><span></span></p>
			</div>
			<div class="col">
				<img src="{$_C.hy_path}images/prince/little_king.png" alt="">
			</div>
			<div class="col">
				<h4>成人门票两张套餐</h4>
				<div class="row">
					<div class="col">
						
						<p>10月30日到11月30日</p>
						<p>任意时间二人同行适用 </p>
					</div>
					<div class="col">
						<h3>￥99</h3>
						
							<span class="cut">-</span>
							<input type="text" name="card4_total" id="card4_total" value="0" readonly="readonly"  >
							<span class="add">+</span>
						
					</div>
				</div>
			</div>
		</div>
		
			<div class="stuff row stuff_click">
			<div class="col radio">
				<p><span></span></p>
			</div>
			<div class="col">
				<img src="{$_C.hy_path}images/prince/little_king.png" alt="">
			</div>
			<div class="col">
				<h4>体验馆小童或长者门票</h4>
				<div class="row">
					<div class="col">
						<p></p>
						<p>10月30日到11月30日</p>
						
						<p>1.4米以下儿童或65岁以上长者使用</p>
					</div>
					<div class="col">
						<h3>￥38</h3>
						<span class="cut">-</span>
						<input type="text" name="card3_total" id="card3_total" value="0"  readonly="readonly"  >
						<span class="add">+</span>
					</div>
				</div>
			</div>
		</div>
		
	</form>
	<div class="modal success_xiadan hide">
		<div class="modal_content">
			<img src="{$_C.hy_path}images/prince/success.png" alt="">
			<img src="{$_C.hy_path}images/prince/sure.png" alt="">
		</div>
	</div>

	<div class="info-top hide">
		<div class="closebtn"></div>
		<div class="info-text">
			<input type="text" class="infocode" id="infocode" placeholder="请输入邀请码">
			<span class="infobtn1" onclick="alertcon()"/>
		</div>
	</div>
	<div class="alert-body"></div>
	<div class="alertcon2 alert-massage page-moveFromTop hide">
		<p id="msg">消息</p>
		<div class="btn-con">
			<input type="button" class="btn">
		</div>
	</div>
<script src="{$_C.hy_path}js/less.min.js"></script>
<script src="{$_C.hy_path}js/zepto.min.js"></script>
<script type="text/javascript" src="{$_C.hy_path}js/jquery-1.10.2.min.js"></script>
        <script type="text/javascript" src="{$_C.hy_path}js/swiper.min.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">
	var isSend = false;
	var pay_place = parseInt('{$pay_place}');
	var is_code_save = false;
	var code_money = 0;
	$(function(){
		  var swiper = new Swiper('.swiper-container', {
		        pagination: '.swiper-pagination',
		       
		        slidesPerView: 1,
		        paginationClickable: true,
		        spaceBetween: 30,
				autoplay:2000

		    });
	});
	
	function flgSubmitInfo(){
		if(isSend){
			showMsg("正在下单，请稍等...");
			return false;
		}
		isSend = true;
		$("#btnXiadan").html("请稍等...");
		 var card1_total = parseInt($("#card1_total").val());
		 var card2_total = parseInt($("#card2_total").val());
		 
		 var card3_total = parseInt($("#card3_total").val());
		 var card4_total = parseInt($("#card4_total").val());
		 
		 var codes = $("#infocode").val();
		 if(card1_total+card2_total+card3_total+card4_total==0){
		 	showMsg("购买数量不能为0");
		 	isSend = false;
		 	$("#btnXiadan").html("立即下单");
			return false;
		 }
		 
		 if(card1_total==0 && card4_total==0 &&card3_total>0){
			 	showMsg("不能单独购买小童票，必须搭配至少一张成人票。");
			 	isSend = false;
			 	$("#btnXiadan").html("立即下单");
				return false;
			 }
		 
		 //alert(code_money)
		 if(pay_place==0){
			 	pay_place = 1;
			 }
		 var data = {
		 	card1_total:card1_total,
			card2_total:card2_total,
			card3_total:card3_total,
			card4_total:card4_total,
			pay_place:pay_place,
			codes:codes,
			code_money:code_money
		 }
		 
		 var url = "index.php?g=mobile&m=wxpay&a=beforehandPay";
			$.post(url,data,function(res){
				
				if(res.error=="1"){
				}else{
					wx.chooseWXPay({
					    package: res.result.package,
					    nonceStr: res.result.nonceStr, 
					    paySign: res.result.paySign,
					    signType: res.result.signType,
					    timestamp: res.result.timeStamp, 
					    success: function (resu) {
							if(resu.errMsg == "chooseWXPay:ok"){
								successPayOrderQuery(res.out_trade_no);
	                        }
					    }
					});
				}
				isSend = false;
				$("#btnXiadan").html("立即下单");
			},"json");
 }
 
 function successPayOrderQuery(out_trade_no){
 	 var url = "index.php?g=mobile&m=wxpay&a=orderquery&out_trade_no="+out_trade_no;
	$.get(url,function(res){
		if(res=="SUCCESS"){
			showMsg("下单成功");
			window.location.href = "index.php?g=mobile&m=picture&a=record";
			//下单成功跳转
		}else{
			showMsg("下单失败");
		}
	},"text");
 }
 function showMsg(msg){
 	$("#msg").html(msg);
	$('.alertcon2').removeClass('hide');
    $('.alert-body').addClass('alert-wrapper');
 }
 
 
 function flgSubmitInfo2(id){
 	 var url = "index.php?g=mobile&m=wxpay&a=chooseWXPay&wx_pay_id="+id;
	$.get(url,function(res){
			if(res.error=="1"){
				showMsg(res.content);
			}else{
				wx.chooseWXPay({
				    package: res.result.package,
				    nonceStr: res.result.nonceStr, 
				    paySign: res.result.paySign,
				    signType: res.result.signType,
				    timestamp: res.result.timeStamp, 
				    success: function (resu) {
						if(resu.errMsg == "chooseWXPay:ok"){
                           successPayOrderQuery(res.out_trade_no);
                        }

				    }
				});
			}
	},"json");
 }
	 var pid = "{$info.wxid|default:'0'}";
	  wx.config({
	    debug: false, 
	    appId: '{$signPackage.appId}',
	    timestamp: {$signPackage.timestamp},
	    nonceStr: '{$signPackage.nonceStr}',
	    signature: '{$signPackage.signature}',
	    jsApiList: [
	      // 所有要调用的 API 都要加到这个列表中
	      'chooseWXPay',
		  'onMenuShareTimeline',
	      'onMenuShareAppMessage',
	    
	    ]
	  });
	
  wx.ready(function () {
  			wx.onMenuShareTimeline({
			    title: '【G4慈善专场】小王子体验馆门票',
			     link:'http://g4.shfyuan.com/xy/index.php?g=mobile&m=wxpay&a=main',
			     imgUrl: 'http://g4.shfyuan.com/xy/Mobile/Webroot/gf/images/picture/little_king.png',
			      trigger: function (res) {
			       
			      },
			      success: function (res) {
			    	  document.getElementById('mcover').style.display='';
						showMsg("分享成功。");
			      },
			      cancel: function (res) {
			       
			      },
			      fail: function (res) {
			        showMsg(JSON.stringify(res));
			      }
		    });
		    
			wx.onMenuShareAppMessage({
			    link:'http://g4.shfyuan.com/xy/index.php?g=mobile&m=wxpay&a=main',
			     title: '【G4慈善专场】小王子体验馆门票',
			    desc: '【G4慈善专场】小王子体验馆门票--每一张正票我们有10元 捐给爱心直达基金',
			  	imgUrl: 'http://g4.shfyuan.com/xy/Mobile/Webroot/gf/images/picture/little_king.png',
			    success: function () { 
			    	document.getElementById('mcover').style.display='';
			    	showMsg("分享成功。");
			    },
			    cancel: function () { 
			        // 用户取消分享后执行的回调函数
			    }
		});
		

});


$('.alertcon2 .btn-con').click(function(){
    $('.alertcon2').addClass('hide');
    $('.alert-body').removeClass('alert-wrapper');
});
$('.info-top .closebtn').click(function(){
	$('.info-top').addClass('hide');
	$('.alert-body').removeClass('alert-wrapper');
})
 function alertcon(){
 	
    var codes = $("#infocode").val()
	if(codes==""||codes==undefined||codes==null){
		showMsg("请输入邀请码");
		return false;
	}
	var url ="index.php?g=mobile&m=wxpay&a=push_code_sub_money&codes="+codes;
	$.get(url,function(res){
		if(res.error==1){
			showMsg(res.content);
		}else{
			code_money = res.result.money;
			is_code_save = true;
			sumPay();
			
			$('.info-top').addClass('hide');
			$('.alert-body').removeClass('alert-wrapper');
			showMsg("邀请码输入成功，成人门票每张减免"+code_money+"元。");
		}
	},"json");
}
function openCode(){
	if(is_code_save){
		showMsg("邀请码已填写，成人门票每张减免"+code_money+"元。");
		//showMsg("请输入邀请码");
		return false;
	}
	 $('.alert-body').addClass('alert-wrapper');
	 $('.info-top').removeClass('hide');
}
</script>
<script src="{$_C.hy_path}js/main2.js"></script>
</body>
</html>